import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
import java.util.concurrent.TransferQueue;

class Solution {
    public int widthOfBinaryTree(TreeNode root) {
        Stack<TreeNode> stack = new Stack<>();
        List<TreeNode> list = new LinkedList<>();
        stack.push(root);
        int max = 0;
        while(!stack.empty()) {
            int tmp = stack.size();
            if(tmp > max) {
                max = tmp;
            }
            while(!stack.empty()) {
                TreeNode cmd = stack.pop();

                if(cmd != null) {
                    stack.push(cmd.left);
                    stack.push(cmd.right);
                }

            }

        }
        return max;
    }
    private int sizaStack(Stack<TreeNode> stack) {
        TreeNode cmd = stack.pop();
        return 1;
    }
}
